<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD><TITLE>is manual page - [incr Tcl]</TITLE>
<link rel="stylesheet" href="../docs.css" type="text/css" media="all">
</HEAD>
<BODY><H2><a href="../contents.htm">Tcl8.6.11/Tk8.6.11 Documentation</a> <small>&gt;</small> <a href="contents.htm">[incr Tcl] Package Commands, version 4.2.1</a> <small>&gt;</small> is</H2>
<H3><A HREF="../UserCmd/contents.htm">Tcl/Tk Applications</A> | <A HREF="../TclCmd/contents.htm">Tcl Commands</A> | <A HREF="../TkCmd/contents.htm">Tk Commands</A> | <A HREF="../ItclCmd/contents.htm">[incr Tcl] Package Commands</A> | <A HREF="../SqliteCmd/contents.htm">SQLite3 Package Commands</A> | <A HREF="../TdbcCmd/contents.htm">TDBC Package Commands</A> | <A HREF="../TdbcmysqlCmd/contents.htm">tdbc::mysql Package Commands</A> | <A HREF="../TdbcodbcCmd/contents.htm">tdbc::odbc Package Commands</A> | <A HREF="../TdbcpostgresCmd/contents.htm">tdbc::postgres Package Commands</A> | <A HREF="../TdbcsqliteCmd/contents.htm">tdbc::sqlite3 Package Commands</A> | <A HREF="../ThreadCmd/contents.htm">Thread Package Commands</A> | <A HREF="../TclLib/contents.htm">Tcl C API</A> | <A HREF="../TkLib/contents.htm">Tk C API</A> | <A HREF="../ItclLib/contents.htm">[incr Tcl] Package C API</A> | <A HREF="../TdbcLib/contents.htm">TDBC Package C API</A></H3>
<H3><A NAME="M2">NAME</A></H3>
itcl::is &mdash; test argument to see if it is a class or an object
<H3><A NAME="M3">SYNOPSIS</A></H3>
<B><A HREF="../ItclCmd/is.htm">itcl::is </A></B><I>option</I> ?<I>arg arg ...</I>?<BR>
<H3><A NAME="M4">DESCRIPTION</A></H3>
The <B>is</B> command is used to check if the argument given is
a class or an object; depending on the option given. If the argument
if a class or object, then 1 is returned. Otherwise, 0 is returned.
The <B>is</B> command also recognizes the commands wrapped in the
itcl <B>code</B> command.
<P>
The <I>option</I> argument determines what action is carried out
by the command.  The legal <I>options</I> (which may be abbreviated)
are:
<P>
<DL class="description">
<DT><A NAME="M5"><B>is class </B><I>command</I></A><DD>
Returns 1 if command is a class, and returns 0 otherwise.
<P>
The fully qualified name of the class needs to be given as the <I>command</I>
argument. So, if a class resides in a namespace, then the namespace needs to
be specified as well. So, if a class <B>C</B> resides in a namespace <B>N</B>, then
the command should be called like:
<P>
<PRE><B>is N::C</B>
    or
<B>is ::N::C</B></PRE>
<P><DT><A NAME="M6"><B>is</B> object ?<B>-class </B><I>className</I>? <I>command</I></A><DD>
Returns 1 if <I>command</I> is an object, and returns 0 otherwise.
<P>
If the optional &quot;<B>-class</B>&quot; parameter is specified, then the
<I>command</I> will be checked within the context of the class
given. Note that <I>className</I> has to exist. If not, then an
error will be given. So, if <I>className</I> is uncertain to be
a class, then the programmer will need to check it's existance
beforehand, or wrap it in a catch statement.
<P>
So, if <B>c</B> is an object in the class <B>C</B>, in namespace N then
these are the possibilities (all return 1):
<P>
<PRE>set obj [N::C c]
itcl::is object N::c
itcl::is object c
itcl::is object $obj
itcl::is object [itcl::code c]</PRE>
<P></DL>
<H3><A NAME="M7">KEYWORDS</A></H3>
<A href="../Keywords/C.htm#class">class</A>, <A href="../Keywords/O.htm#object">object</A>
<div class="copy">Copyright &copy; 1993-1998 Lucent Technologies, Inc.
</div>
</BODY></HTML>
